import React from 'react'
import { Card, Col, Row ,Button, Checkbox, Form, Input } from 'antd';
import type { FormProps } from 'antd';
type FieldType = {
  username?: string;
  password?: string;
  remember?: string;
};

export default function Login(props) {
    const onFinish: FormProps<FieldType>['onFinish'] = (values) => {
  console.log('Success:', values);
  localStorage.setItem('token',values.username)
  props.history.push('/home')
};

  return (
    <div>
      <Row gutter={16}>
    <Col span={8} style={{margin:'10px auto',textAlign:'center'}}>
      <Card title="去登陆" variant="borderless">
         <Form

    onFinish={onFinish}
  >
    <Form.Item<FieldType>
      label="Username"
      name="username"
      rules={[{ required: true, message: 'Please input your username!' }]}
    >
      <Input />
    </Form.Item>

    <Form.Item<FieldType>
      label="Password"
      name="password"
      rules={[{ required: true, message: 'Please input your password!' }]}
    >
      <Input.Password />
    </Form.Item>



    <Form.Item label={null}>
      <Button type="primary" htmlType="submit">
        Submit
      </Button>
    </Form.Item>
  </Form>
      </Card>
    </Col>
  </Row>
    </div>
  )
}
